<template>
  <div>
    <button @click="ADD_NUM(10)">+</button>
    <button @click="REDUCE_NUM(5)">-</button>
    {{ num }}
    <ul>
      <li v-for="cate in cates" :key="cate.id">
        <img :src="cate.icon" alt="">
        <h5>{{cate.name}}</h5>
      </li>
    </ul>
  </div>
</template>

<script>
import { mapState, mapMutations, mapActions } from 'vuex'
export default {
  created () {
    this.FETCH_CATES()
  },
  methods: {
    ...mapMutations(['ADD_NUM', 'REDUCE_NUM']),
    ...mapActions(['FETCH_CATES'])
  },
  computed: {
    ...mapState(['num', 'cates'])
  }
}
</script>

<style lang="scss" scoped>

</style>
